package com.hello.tong.controller;

import com.hello.tong.service.IAccountService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tong-exists
 * @since 2022-12-31
 */
@RestController
public class AccountController {

    @Autowired
    private IAccountService accountService;

    @PostMapping("/debit/{userId}/{money}")
//    @GlobalTransactional
    public void debit(@PathVariable("userId") String userId, @PathVariable("money") int money) {
        accountService.debit(userId, money);
    }

}
